from .yuntongxun.sms import CCP
from . import constants
from celery_tasks.main import celery_app


# 使用装饰器task,将send_sms_code装饰为异步任务，并设置别名name='send_sms_code'
@celery_app.task(name='send_sms_code')
def send_sms_code(mobile, sms_code):
    """
    发送短信验证码
    :param mobile: 手机号
    :param sms_code: 短信验证码
    :return: None
    """
    CCP().send_template_sms(mobile, [sms_code, constants.SMS_CODE_TEMPLATE_EXPIRES], constants.SMS_CODE_TEMPLATE_ID)
